home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.text;
-
- import java.util.Enumeration;
-
- class StyleContext$SmallAttributeSet implements AttributeSet {
- // $FF: synthetic field
- StyleContext this$0;
- Object[] attributes;
- int nrefs;
-
- // $FF: synthetic method
- StyleContext$SmallAttributeSet(StyleContext this$0, Object[] attributes) {
- this.this$0 = this$0;
- this.attributes = attributes;
- }
-
- // $FF: synthetic method
- StyleContext$SmallAttributeSet(StyleContext this$0, AttributeSet attrs) {
- this.this$0 = this$0;
- int n = attrs.getAttributeCount();
- Object[] tbl = new Object[2 * n];
- Enumeration names = attrs.getAttributeNames();
-
- for(int i = 0; names.hasMoreElements(); i += 2) {
- tbl[i] = names.nextElement();
- tbl[i + 1] = attrs.getAttribute(tbl[i]);
- }
-
- this.attributes = tbl;
- }
-
- Object getLocalAttribute(Object nm) {
- Object[] tbl = this.attributes;
-
- for(int i = 0; i < tbl.length; i += 2) {
- if (nm.equals(tbl[i])) {
- return tbl[i + 1];
- }
- }
-
- return null;
- }
-
- public String toString() {
- String s = "{";
- Object[] tbl = this.attributes;
-
- for(int i = 0; i < tbl.length; i += 2) {
- if (tbl[i + 1] instanceof AttributeSet) {
- s = s + tbl[i] + "=" + "AttributeSet" + ",";
- } else {
- s = s + tbl[i] + "=" + tbl[i + 1] + ",";
- }
- }
-
- s = s + "nrefs=" + this.nrefs + "}";
- return s;
- }
-
- public int hashCode() {
- int code = 0;
- Object[] tbl = this.attributes;
-
- for(int i = 1; i < tbl.length; i += 2) {
- code ^= tbl[i].hashCode();
- }
-
- return code;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof AttributeSet) {
- AttributeSet attrs = (AttributeSet)obj;
- return this.getAttributeCount() == attrs.getAttributeCount() && this.containsAttributes(attrs);
- } else {
- return false;
- }
- }
-
- public int getAttributeCount() {
- return this.attributes.length / 2;
- }
-
- public boolean isDefined(Object key) {
- Object[] a = this.attributes;
- int n = a.length;
-
- for(int i = 0; i < n; i += 2) {
- if (key.equals(a[i])) {
- return true;
- }
- }
-
- return false;
- }
-
- public boolean isEqual(AttributeSet attr) {
- if (attr instanceof StyleContext$SmallAttributeSet) {
- return attr == this;
- } else {
- return this.getAttributeCount() == attr.getAttributeCount() && this.containsAttributes(attr);
- }
- }
-
- public AttributeSet copyAttributes() {
- return this;
- }
-
- public Object getAttribute(Object key) {
- Object value = this.getLocalAttribute(key);
- if (value == null) {
- AttributeSet parent = this.getResolveParent();
- if (parent != null) {
- value = parent.getAttribute(key);
- }
- }
-
- return value;
- }
-
- public Enumeration getAttributeNames() {
- return new StyleContext.KeyEnumeration(this.this$0, this.attributes);
- }
-
- public boolean containsAttribute(Object name, Object value) {
- return value.equals(this.getAttribute(name));
- }
-
- public boolean containsAttributes(AttributeSet attrs) {
- boolean result = true;
-
- Object name;
- for(Enumeration names = attrs.getAttributeNames(); result && names.hasMoreElements(); result = attrs.getAttribute(name).equals(this.getAttribute(name))) {
- name = names.nextElement();
- }
-
- return result;
- }
-
- public AttributeSet getResolveParent() {
- return (AttributeSet)this.getLocalAttribute(StyleConstants.ResolveAttribute);
- }
-
- public Object clone() {
- return this;
- }
- }
-